const common = {
    toast: function (text, flag) {
        let div = document.createElement('div')
        div.className = 'mantle'
        div.innerHTML = `<div class="toast">${flag ? '<i class="iconfont icon-duigouxiao success"></i>' : '<i class="iconfont icon-cuo error"></i>'}
                        <div>${text}</div>
                        </div>`
        document.body.appendChild(div);

        setTimeout(function () {
            div.remove()
        }, 2000)
    },
    footer: function (page) {
        let footer = document.createElement('footer')
        footer.className = 'dpflex'
        footer.innerHTML = `<a href="./index.html" class="${page == '首页' ? 'active' : ''}">
                                <i class="iconfont icon-31shouye"></i>
                                <div class="page">首页</div>
                            </a>
                            <a href="./motion.html" class="${page == '运动' ? 'active' : ''}">
                                <i class="iconfont icon-xindong"></i>
                                <div>运动</div>
                            </a>
                            <a href="./mine.html"  class="${page == '我的' ? 'active' : ''}">
                                <i class="iconfont icon-wode"></i>
                                <div>我的</div>
                            </a>`

        document.body.appendChild(footer)
    }
}

window.common = common